package cn.lsoft.undoner.service.message.impl;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.integration.kafka.support.KafkaHeaders;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.messaging.MessageChannel;
import org.springframework.stereotype.Service;

import cn.lsoft.undoner.dao.domain.User;
import cn.lsoft.undoner.service.message.MessageService;

/** 
* @ClassName: MessageServiceImpl 
* @Description: TODO(这里用一句话描述这个类的作用) 
* @author undoner@gmail.com
* @date 2017年1月21日 下午8:16:22 
*/
@Service
public class MessageServiceImpl implements MessageService{
	private static final Logger logger = LoggerFactory.getLogger(MessageServiceImpl.class);
	@Autowired
	@Qualifier("kafkaTopicTest")
	private MessageChannel messageChannel;
	@Override
	public void sendInfo(String topic, Object obj) {
		logger.error("KafkaService------sendInfo------");
		messageChannel.send(MessageBuilder.withPayload(obj).setHeader(KafkaHeaders.TOPIC,topic).build());
		
	}


}
